<?php
$data = array();

$job_id = $dbfunc->getMax_Column('tb_job','job_id','') + 1;
$file_name = explode('.',$_FILES['job_file']['name']);
$file_name = $job_id.'.'.array_pop($file_name);

$insert = array(
	job_id => $job_id,
        job_name => $_POST['job_name'],
	job_scoretop => $_POST['job_scoretop'],
        job_detail => $_POST['job_detail'],
        job_file => $file_name,
        job_date => $_POST['job_date'].' '.$_POST['h'].':'.sprintf('%02d',$_POST['m']).':00',
        sec_id => $_POST['sec_id']
);

$data['success'] = false;

if(copy($_FILES['job_file']['tmp_name'],'job/'.$file_name)){
    if($dbfunc->insert("tb_job",$insert)){
	$data['success'] = true;
        $data['insert'] = $insert;
    }
}
echo json_encode($data);
